﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.Util;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using System.IO;
namespace Com.CMS263.Web.manage.VoteManage
{
    public partial class vote_option_add : System.Web.UI.Page
    {
        VoteOptionBLL pbll = new VoteOptionBLL();
        public int sort = 1;
        public int tid = 0;
        public VoteTopic vt = new VoteTopic();
        VoteTopicBLL vtbll = new VoteTopicBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

            sort = pbll.GetMaxId();
            tid = Convert.ToInt32(Request["tid"]);
            if (tid <= 0)
            {
                StringUtil.Alert("抱歉,没有找到相关数据", "vote_list.aspx");
            }
            vt = (VoteTopic)vtbll.FindModelById("VoteTopic", tid);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string title = StringUtil.checkStr(Request["txtTitle"]);
            

            string sortid = StringUtil.checkStr(Request["txtSortId"]);

            VoteOption prod = new VoteOption();

            prod.ClickCount = 0;
            prod.OptionValue = title;
            prod.SortId=Convert.ToInt32(sortid);
            prod.VoteTopicId = tid;


            pbll.entity = prod;
            if (pbll.Add())
            {
                StringUtil.Alert("添加成功", "vote_option_list.aspx?tid=" + tid);
            }


        }

    }
}
